1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17�
�^UNc @ s d d d � � YZ d S( t FruitShopc B s, e Z d � Z d � Z d � Z d � Z RS( c C s | | _ | | _ d | GHd S( s�
name: Name of the fruit shop
fruitPrices: Dictionary with keys as fruit
strings and prices for values e.g.
{'apples':2.00, 'oranges': 1.50, 'pears': 1.75}
s Welcome to %s fruit shopN( t fruitPricest name( t selfR R ( ( s' D:\Documents\Schoolwork\CS 3600\shop.pyt __init__ s c C s' | | j k r d | GHd S| j | S( s�
fruit: Fruit string
Returns cost of 'fruit', assuming 'fruit'
is in our inventory or None otherwise
s Sorry we don't have %sN( R t None( R t fruit( ( s' D:\Documents\Schoolwork\CS 3600\shop.pyt getCostPerPound s c C sM d } x@ | D]8 \ } } | j | � } | d k r
| | | 7} q
q
W| S( s�
orderList: List of (fruit, numPounds) tuples
Returns cost of orderList. If any of the fruit are
g N( R R ( R t orderListt totalCostR t numPoundst costPerPound( ( s' D:\Documents\Schoolwork\CS 3600\shop.pyt getPriceOfOrder"